<#include "/tags/updatedSinceTag.ftl">
<#macro activityItem ownerAction ownerComponent action component componentId updatedMinutes updateDate
		 ownerActionAvatar="/images/avatar.png" componentTitle="">
	
	<#assign actionText=""/>
	<#assign actionText1=""/>
	<#assign sourceUser=ownerAction/>
	<#assign targetUser=ownerComponent/>
	<#switch action>
		<#case "FINISH_GOAL">
			<#assign actionText="hoàn thành"/>		
			<#assign actionText1="mục tiêu"/>
			<#assign targetUser=""/>
		<#break>
		<#case "UPDATE">
			<#assign actionText="cập nhật"/>		
			<#assign targetUser=""/>
		<#break>
		<#case "BE_FRIEND_WITH">
			<#assign actionText="kết bạn với"/>
			<#assign targetUser=ownerAction/>
			<#assign sourceUser=ownerComponent/>
		<#break>
		<#case "NEW">
			<#switch component>
				<#case "GOAL_ENTRY">
					<#assign actionText="tạo bài viết cho mục tiêu"/>
					<#break>
				<#case "DONE_ENTRY">
					<#assign actionText="chia sẻ quá trình hoàn thành mục tiêu"/>
					<#break>
				<#case "GOAL">
					<#assign actionText="thêm mục tiêu"/>
					<#break>
				<#default>
			</#switch>
			<#assign targetUser=""/>
		<#break>
		<#case "CHEER">
			<#assign actionText="chúc mừng"/>
			<#assign actionText1="hoàn thành mục tiêu"/>
			<#assign targetUser=ownerComponent/>
		<#break>
		<#case "ENCOURAGE">
			<#assign actionText="động viên"/>
			<#assign actionText1="thực hiện mục tiêu"/>
			<#assign targetUser=ownerComponent/>
		<#break>
		<#default>		
	</#switch>
	
	<#assign componentText=""/>
	<#assign componentLink=""/>
	<#switch component>
		<#case "DONE_ENTRY">
			<#assign componentText=componentTitle/>
			<#assign componentLink="/done/view/${componentId}"/>			
		<#break>
		<#case "GOAL_ENTRY">
			<#assign componentText=componentTitle/>
			<#assign componentLink="/entry/view/${componentId}"/>
		<#break>
		<#case "FRIEND">			
		<#break>
		<#case "GOAL">
			<#assign componentText=componentTitle/>
			<#assign componentLink="/goal/view/${componentId}"/>
			<#assign actionText1="mục tiêu"/>
		<#break>
		<#case "USER_STATUS">
			<#assign actionText1="trạng thái thành"/>
			<#assign componentText=componentTitle/>
			<#assign targetUser=""/>
			<#assign componentLink="/${ownerAction}"/>
		<#break>
		<#case "USER_AVATAR">
			<#assign componentText="hình đại diện"/>
			<#assign targetUser=""/>
			<#assign componentLink="/${ownerAction}"/>
		<#break>
		<#default>
	</#switch>	
	<li id="${updateDate}">
    	<a href="/${sourceUser}" class="avatar25x25"><img src="${ownerActionAvatar}" width="40" /></a>
    	<p>
    		<a href="/${sourceUser}">${sourceUser}</a> vừa ${actionText} 
    		<#if (targetUser?length > 0)>
    		<a href="/${targetUser}">${targetUser}</a> 
    		</#if>
    		<#if actionText1?has_content>
    		${actionText1} 
    		</#if>
    		<#if componentLink?has_content>
    		<a href="${componentLink}" class="textGoal">${componentText}</a>
    		</#if>
    		<br/>
			<span><@updatedSince minutes=updatedMinutes prefix='page.dashboard.updateSince'/></span>
		</p>
    </li>
</#macro>